#
#
CDEPEND         = makedepend $(CFLAGS)
#CFLAGS          = -O2 $(INCLUDEDIRS)
CFLAGS          =  $(INCLUDEDIRS)
COBJS           = $(CSRCS:%.c=%.o)
CSRCS  =  src/elk_sip_address.c \
	src/elk_sip.c \
	src/elk_msg.c \
	src/rfc2617.c \
	src/elk_parse.c \
	src/via_parse.c \
	src/www_auth.c  \
	src/elk_nonce.c \
	src/contact.c \
	src/md5.c \
	src/elk_version.c \
	src/elk_fsm.c \
	src/elk_transport.c \
	src/elk_auth.c


INCLUDEDIRS     = -I../util/inc -I./inc -I./
CC = gcc -g -Wall 
AR = ar
LIBDIRS         = -L../util/  -L.
LIBS            = $(LIBDIRS) -lpthread -lelkutil
LDFLAGS         = $(LIBS)


PROJ            = libelksip
#noinst_LIBRARIES 
 
all: $(PROJ)

cdepend: $(CSRCS)
	$(CDEPEND) $(CSRCS)
 
clean:
	rm -f $(COBJS)
	rm -f *.so *.a
	rm -f unit_test anomaly_test
 

$(PROJ): $(COBJS)
	$(AR) cru $@.a $(COBJS)
	$(CC) -shared -o $@.so  $(COBJS) $(LDFLAGS)	
	$(CC) test/unit_test.c -static $(INCLUDEDIRS) $(LIBDIRS) -lelksip -lelkutil -lpthread -o unit_test
	$(CC) test/anomaly_test.c -static $(INCLUDEDIRS) $(LIBDIRS) -lelksip -lelkutil -lpthread -o anomaly_test
	$(CC) test/nonce_test.c -static $(INCLUDEDIRS) $(LIBDIRS) -lelksip -lelkutil -lpthread -o nonce_test
	$(CC) test/encoding_test.c -static $(INCLUDEDIRS) $(LIBDIRS) -lelksip -lelkutil -lpthread -o encoding_test

